package service.Impl;

import Dao.AdminDao;
import Dao.Impl.AdminDaoImpl;
import pojo.Admin;
import service.AdminService;

import java.sql.SQLException;

/**
 * @author zhangyu
 * @date 2021/11/17    20:52
 */
public class AdminServiceImpl implements AdminService {

    @Override
    public Admin findAdmin(String username, String password) {
        try {
            AdminDao admindDao = new AdminDaoImpl();
            Admin admin = admindDao.selectAdminByName(username);
            if(admin!=null){
                if(admin.getPassword().equals(password)){
                    return  admin ;
                }
            }
        }catch (SQLException e){
            e.printStackTrace();
        }

        return null;
    }
}
